﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SAKS.IServices;
using NHibernate;

namespace SAKS.Services
{
    public abstract class ServicesBase<T> : IServicesBase<T>
    {
        public ISession Session { get; set; }

        public void Save(T t)
        {
            Session.Save(t);
        }
        public T Get(Guid id)
        {
            return Session.Get<T>(id);
        }

        public void Delete(Guid id)
        {
            var o = Session.Get<T>(id);
            if (o != null)
                Session.Delete(o);
        }

        public abstract void Update(T award);

        public abstract object[] List(int first, int pageSize, out int? totalRecords, string key);
    }
}
